package hn.cch.security;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletRequestWrapper;
import java.util.Objects;

public class MyHttpServletRequestWrapper extends HttpServletRequestWrapper {


    public MyHttpServletRequestWrapper(HttpServletRequest request) {
        super(request);
    }

    @Override
    public String getParameter(String name) {
        String parameter = super.getParameter(name);
        if (Objects.equals("password", name)){ // spring-security使用form-data请求，对于参数是username和password
            // 指定加解密方式
            return passwordDecrypt(parameter);
        }
        return parameter;
    }

    public String passwordDecrypt(String password){
        return password;
    }
}
